Rapid Database Application Development
|
||
Development |
"Microsoft Access for Linux"
|
|
Form Actionsstarted in 2005, jstaniek macros support added in 2006, dipesh updated in december 2006 for Kexi 1.1.2, jstaniek << Back to Forms
At the moment it's possible to connect a button with "Assign Action" with a shared action Kexi provides to execute a predefined (global i.e. shared or local) action if the button has been clicked. Action CategoriesIt's not that productive to just execute a global action -- sometimes there's a need for executing action in a context of a given object. So there are more ways available to execute actions. These ways are the reason for existence of so called action categories. The following categories are identified and implemented:
These categories can be combined, e.g. "edit_delete" is supported both by Part Item and Global action categories. Actions can be in at least one category called "No category" -- actions without categories will not be visible within the actions selection dialog. ^ tocUsage of the action categoriesThe categories can be defined using Kexi::ActionCategories helper class of kexicore library. There is a singleton object available using Kexi::ActionCategories* Kexi::actionCategories() static function, used by KexiMainWindowImpl::initActions(). All shared actions are and should be declared for zero or more categories. The reason for configuring action categories at the top level (main window) is that we need this to be performed once and have it related to shared actions (whose are declared at KexiMainWindowImpl object's level). ^ tocThe action selection dialogThe dialog allows to select a single action that will be assigned to a previously selected button widget. The only way for now to show the dialog is to select the 'Assign Action...' command from the button's context menu in the form's Design View. The dialog is implemented by KexiActionSelectionDialog class of kexiformutils library. ^ tocActions assignments at runtimeKexiFormEventHandler class takes care of initializing physical (signal-slot) assignments for predefined design-time assignments stored in a form design. KexiFormEventAction class takes care of decoding the storege format (e.g. "table:cars") into a set of well defined data members and provides activation routine (KexiFormEventAction::activate()) for actions that require a context to be executed. Global actions are executed automatically as a response to previously performed signal-slot connection between button's clicked() signal and shared (global) action's activate() slot (see KexiFormEventHandler::setMainWidgetForEventHandling()). ^ tocStorage format for action assignmentsKexi Form's XML file format (which is in turn Qt Designer-based) has been utilized to store action assignment information. The extenstion is an effect of using two additional Qt properties of the button widget class:
This gives the following XML chunk: <widget class="KexiPushButton" > ... <property name="onClickAction" > <string>{actionCategoryAndName}</string> </property> <property name="onClickActionOption" > <string>{actionOption}</string> </property> .... </widget> where {actionCategoryAndName} and {actionOption} denote action name and optional category. There are following cases:
Thanks to using properties and prefixes, the assignment format is open for future extensions (e.g. for adding new actions or contexts and object types). For backward compatibility with Kexi < 1.1.2, where there were no action options available: if there is no {actionOption} property provided, open is assumed for all object types except macros and scripts, for whose execute action is assumed. |
|||||
|